﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>

</head>
<body>
    <textarea id="textareaAdd" lay-filter="textareaAdd" name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
    <input type="button" onclick="cleanWord();" value="Word清理" />
    <script>
        cleanWord = function () {
            var html = window.document.getElementById("textareaAdd").value;
            html = html.replace(/<\/?SPAN[^>]*>/gi, "" );
            html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
            html = html.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ; 
            html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
            html  =  html.replace(/<\\?\?xml[^>]*>/gi,  "") ;
            html = html.replace(/<\/?\w+:[^>]*>/gi, "") ; 
            html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;


            html = html.replace(/<o:p> <\/o:p>/g, "");
            html = html.replace(/o:/g, "");
            html = html.replace(/<font>/g, "");
            html = html.replace(/<FONT>/g, "");
 
            html = html.replace(/<SPAN>/g, "");
            html = html.replace(/<SPANlang=EN-US>/g, "");
            html = html.replace(/<P>/g, "");
            html = html.replace(/<\/P>/g, "");
            html = html.replace(/<\/SPAN>/g, "");
            alert(html);
        }</script>
</body>
</html>